<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('goods/index')}">列表</a></li>
			<li class="active"><a >{:lang('EDIT')}</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" enctype="multipart/form-data" action="{:url('goods/edit')}">
			<div class="row">
				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">名称</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" name="goods_name" value="{$data.goods_name|default=''}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">副标题</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control" name="goods_subname" value="{$data.goods_subname|default=''}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">分类</label>
					<div class="col-md-6">
						<select name="cid" class="form-control">
							<volist name="class" id="vo">
								<option value="{$key}" {$data.cid==$key?'selected':''}>{$vo}</option>
							</volist>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label for="input-thumb" class="col-sm-2 control-label">封面图</label>
					<div class="col-md-6 col-sm-10">
						<input type="hidden" name="image" id="master-image" value="{$data.image|default=''}">
						<a href="javascript:uploadOneImage('图片上传','#master-image');">
							<img src="{:cmf_get_image_url($data.image)}" id="master-image-preview" style="cursor: pointer;max-width:100px;" class="img-responsive">
						</a>
					</div>
				</div>

				<div class="form-group">
					<label for="" class="col-sm-2 control-label">主图</label>
					<div class="col-md-6 col-sm-2">
						<ul id="photos" class="list-unstyled">
							<volist name="data.goods_images" id="vo">
								<li id="savedimage{$key}" class="">
									<input id="photo-{$key}" type="hidden" name="goods_images[]" value="{$vo}">
									<img src="{:cmf_get_image_url($vo)}" id="phone-{$key}-preview" style="width: 150px; cursor: pointer" onclick="parent.imagePreviewDialog(this.src)">
									<a href="javascript:(function(){$('#savedimage{$key}').remove();})();">移除</a>
								</li>
							</volist>
						</ul>
						<a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-wrapper');" class="btn btn-sm btn-success">添加图片</a>
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">价格</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control"  name="goods_price" value="{$data['goods_price']|default=0.00}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">库存</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control"  name="goods_num" value="{$data['goods_num']|default=0}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">库存报警</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control"  name="warning_num" value="{$data['warning_num']|default=0}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">销量</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control"  name="goods_sale_num" value="{$data['goods_sale_num']|default=0}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">首页显示</label>
					<div class="col-md-6 col-sm-10">
						<select name="is_index" class="form-control">
							<option value="0">否</option>
							<option value="1" {$data.is_index==1?'selected':''}>显示</option>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">是否上新</label>
					<div class="col-md-6 col-sm-10">
						<select name="is_new" class="form-control">
							<option value="0">否</option>
							<option value="1" {$data.is_new==1?'selected':''}>推荐</option>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">推荐</label>
					<div class="col-md-6 col-sm-10">
						<select name="is_top" class="form-control">
							<option value="0">否</option>
							<option value="1" {$data.is_top==1?'selected':''}>上top</option>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label for="input-name" class="col-sm-2 control-label">重量</label>
					<div class="col-md-6 col-sm-10">
						<input type="text" class="form-control"  name="weight" value="{$data['weight']|default=0.00}">
					</div>
				</div>

				<div class="form-group">
					<label for="input-needcoin" class="col-sm-2 control-label"><span class="form-required">*</span>审核状态</label>
					<div class="col-md-6 col-sm-10">
						<select class="form-control" name="goods_verify">
							<option value="0">未审核</option>
							<option value="1" {$data.goods_verify==1?'selected':''}>已审核</option>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label for="input-content" class="col-sm-2 control-label">{:lang('商品详情')}</label>
					<div class="col-md-6 col-sm-10">
						<script type="text/plain" id="content" name="goods_content" {$data.goods_content|default=''}></script>
					</div>
				</div>

				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<input type="hidden" name="id" value="{$data.id}" />
						<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('确认')}</button>
						<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
					</div>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript">
		//编辑器路径定义
		var editorURL = GV.WEB_ROOT;
	</script>
	<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript">
		$(function () {
			editorcontent = new baidu.editor.ui.Editor();
			editorcontent.render('content');
			try {
				editorcontent.sync();
			} catch (err) {
			}
		})

	</script>

	<script type="text/html" id="photos-item-wrapper">
		<li id="savedimage{id}">
			<input id="photo-{id}" type="hidden" name="goods_images[]" value="{filepath}">
			<a href="javascript:uploadOneImage('图片上传','#photo-{id}');">
				<img src="{preview_url}" id="photo-{id}-preview" style="width:150px;cursor: pointer">
			</a>
			<a href="javascript:(function(){$('#savedimage{id}').remove();})();">移除</a>
		</li>
	</script>

</body>
</html>